/**
 * JS-UI Vue 0.0.1
 * vue2 app ui
 * https://github.com/jack0888/js-ui#readme
 *
 * Copyright 2015-2018 Jack
 *
 * Released under the ISC License
 *
 * Released on: October 15, 2018
 */
function __vueComponentProps (component) {
  var props = {};
  var $props = component.$props;
  Object.keys($props).forEach(function (propKey) {
    if (typeof $props[propKey] !== 'undefined') { props[propKey] = $props[propKey]; }
  });

  var children = [];
  Object.keys(component.$slots).forEach(function (slotName) {
    children.push.apply(children, component.$slots[slotName]);
  });
  props.children = children;

  return props;
}

var app = {
  name: 'js-app',
  props: {
    id: [String, Number]
  },

  data: function data() {
    var props = __vueComponentProps(this);

    var state = (function () {
      return {
        modals: []
      };
    })();

    return {
      state: state
    };
  },

  render: function render() {
    var _h = this.$createElement;
    var self = this;
    var props = self.props;
    var id = props.id;
    var style = props.style;
    var className = props.className;
    var classes = className + " js-root";
    return _h('div', {
      ref: 'el',
      style: style,
      class: classes,
      attrs: {
        id: id || 'js-root'
      }
    }, [this.$slots['default']]);
  },

  mounted: function mounted() {
    var self = this;
    var el = self.$refs.el;
    var parentEl = el.parentNode;

    if (parentEl && parentEl !== document.body && parentEl.parentNode === document.body) {
      parentEl.style.height = '100%';
    }
  },

  computed: {
    props: function props() {
      return __vueComponentProps(this);
    }

  }
};

export default app;
